package org.jeecg.modules.driver;

import org.jeecg.modules.util.ByteUtils;

import java.util.HashMap;

public class DriverCommandList {

    public static final String LOGIN = "login";
    public static final String DISCONNECT = "disconnect";
    public static final String SET_DEVICE_CHANNEL_SWITCH = "setDeviceChannelSwitch";  //设置设备32电路开关
    public static final String SET_DEVICE_CHANNEL_CURRENT="setDeviceChannelCurrent";  //设置设备总电流
    public static final String SET_DEVICE_CONFIG="setDeviceConfig";  //设置设备其它限值
    public static final String SET_DEVICE_LOCAL_DATA = "setDeviceLocalData";

    //Device To Server
    public static final String D_deviceBase = "deviceBase";   //设备基础信息
    public static final String D_deviceSetConfig = "deviceSetConfig";  //设备配置的预警值信息
    public static final String D_deviceDhcpIpPort = "deviceDhcpIpPort";  //设备网络信息
    public static final String D_deviceSubnetMask = "deviceSubnetMask";  //设备基础信息
    public static final String D_deviceGateway = "deviceGateway";  //设备网关信息1
    public static final String D_deviceMac = "deviceMac"; //设备网关信息2
    public static final String D_deviceCurrent = "deviceCurrent"; //设备电流信息
    public static final String D_deviceSwitch = "deviceSwitch"; //设备开关状态
    public static final String D_deviceCurrentLimit = "deviceCurrentLimit"; //设备电流设置上限
    public static final String D_deviceWarningDevice = "deviceWarningDevice";  //设备报警
    public static final String D_deviceWanringChannel = "deviceWanringChannel"; //设备开关32路报警
    public static final String D_deviceMainStatus = "deviceMainStatus"; //设备主状态信息
    public static final String D_DeviceDNS = "deviceDNS";//设备网关信息3
    public static final String D_LOCAL_DISCONNECT = "deviceLocalDisconnect"; //非设备命令，自己后台发给队列断开设备用的指令
    public static final String D_LOCAL_CONNECTED = "deviceLocalConnected";  //非设备命令，自己后台发给队列更新设备连接状态的指令
    public static final String D_LOCAL_UPDATE = "deviceLocalUpdate";   //非设备命令，未使用
    public static final String ACK = "ACK";  //非设备命令


    public static HashMap<Long,String> deviceReplyCommand = new HashMap<Long, String>(){
        {
            put(ByteUtils.unsigned4BytesToInt(new byte[]{(byte)0xFD,0x09,0x00,0x00},0),D_deviceBase);
            put(ByteUtils.unsigned4BytesToInt(new byte[]{(byte)0xFD,0x01,0x00,0x00},0),D_deviceSetConfig);
            put(ByteUtils.unsigned4BytesToInt(new byte[]{(byte)0xFD,0x02,0x00,0x00},0),D_deviceDhcpIpPort);
            put(ByteUtils.unsigned4BytesToInt(new byte[]{(byte)0xFD,0x03,0x01,0x00},0),D_deviceSubnetMask);
            put(ByteUtils.unsigned4BytesToInt(new byte[]{(byte)0xFD,0x03,0x02,0x00},0),D_deviceGateway);
            put(ByteUtils.unsigned4BytesToInt(new byte[]{(byte)0xFD,0x03,0x03,0x00},0),D_DeviceDNS);
            put(ByteUtils.unsigned4BytesToInt(new byte[]{(byte)0xFD,0x03,0x04,0x00},0),D_deviceMac);
            put(ByteUtils.unsigned4BytesToInt(new byte[]{(byte)0xFD,0x04,0x00,0x00},0),D_deviceCurrent);
            put(ByteUtils.unsigned4BytesToInt(new byte[]{(byte)0xFD,0x05,0x00,0x00},0),D_deviceSwitch);
            put(ByteUtils.unsigned4BytesToInt(new byte[]{(byte)0xFD,0x06,0x00,0x00},0),D_deviceCurrentLimit);
            put(ByteUtils.unsigned4BytesToInt(new byte[]{(byte)0xFD,0x07,0x00,0x00},0),D_deviceWarningDevice);
            put(ByteUtils.unsigned4BytesToInt(new byte[]{(byte)0xFD,0x07,0x01,0x00},0),D_deviceWanringChannel);
            put(ByteUtils.unsigned4BytesToInt(new byte[]{(byte)0xFD,0x08,0x00,0x00},0),D_deviceMainStatus);
        }
    };
}
